﻿using System;
using Store.Model.Models;
using Store.Dal;
using Store.ViewModel;
using System.Collections.Generic;

namespace Store.Bll
{
    public class EmployeeRegisterBll
    {
        private readonly EmployeeRegisterDal dal;
        public EmployeeRegisterBll(EmployeeRegisterDal dl)
        {
            dal = dl;
        }
        //员工登录
        public int Login(string EmployeeAccount = null, string PassWords = null)
        {
            return dal.Login(EmployeeAccount, PassWords);
        }
        
        //查询员工权限下的菜单信息
        public List<EmployeeMenu> GetEmployeeMenus()
        {
            return dal.GetEmployeeMenus();
        }
        //显示员工信息
        public List<EmployeeModel> GetEmployee(string AccountName, string Pid, int PageIndex, int PageSize, out int total)//
        {
            return dal.GetEmployee(AccountName, Pid, PageIndex, PageSize, out total);
        }
        //员工添加
        public int EmployeeAdd(Employee emp)
        {
            emp.States = 1;//1代表启用，0代表禁用，默认为启用
            emp.CreateTime = DateTime.Now;
            emp.Img = "123";
            emp.RegisterTime = DateTime.Now;
            emp.EalterPeople = "11";
            emp.EalterTime = DateTime.Now;
            emp.EntryTime = DateTime.Now;
            emp.EmpState = 1; //(1未删除，0删除)
            return dal.EmployeeAdd(emp);
        }

        //删除员工信息
        public int DeleteEmployee(int id)
        {
            return dal.DeleteEmployee(id);
        }
        //修改员工信息
        public int EditEmployee(Employee emp)
        {
            return dal.EditEmployee(emp);
        }
        //绑定下拉框
        public List<Position> GetPositionSelect()
        {
            return dal.GetPositionSelect();
        }
        //显示角色信息
        public List<Position> GetPositions(int PageIndex, int PageSize, out int total)
        {
            return dal.GetPositions(PageIndex,PageSize,out total);
        }
        //添加角色信息
        public int AddPositions(Position p)
        {
            p.Pcount = 0;
            p.AlterPeople ="123";
            p.CreatePeople = "11";
            p.AlterTime = DateTime.Now;
            p.CreateTime = DateTime.Now;
            p.PostState = 1; //(1未删除，0删除)
            return dal.AddPositions(p);
        }
        //角色删除
        public int DeletePositions(int id)
        {
            return dal.DeletePositions(id);
        }
        //角色修改
        public int EditPositions(Position s)
        {
            return dal.EditPositions(s);
        }
    }
}
